package com.example.project.controller;

import com.example.project.pojo.Result;
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@RequestMapping("file")
public class FileController {
    @PostMapping("/upload")
    public Result upload(MultipartFile file){

        return Result.success("");//返回文件的连接，这个链接就是文件的下载地址，这个下载地址就是后台提供的
    }

    @GetMapping("/download")
    public void download(HttpServletResponse response)throws IOException {
        ServletOutputStream outputstream = response.getOutputStream();
        //outputstream.write(new );//写出一个字节数组，就是文件的字节流数组
    }
}
